@include('Admin.public.head')
<body>
@include('Admin.public.menu')
<div class=" admin-content" id="system">
  <div class="daohang">

  </div>
  <div class="admin-biaogelist">
    <div class="listbiaoti am-cf">
      <ul class="am-icon-flag on"> 管理员列表</ul>
      <dl class="am-icon-home" style="float: right;"> 当前位置： 首页 > <a href="#">商品列表</a></dl>
      <dl>
        <button type="button" class="am-btn am-round am-btn-xs am-icon-plus"><a  href="/admin/system/addUserPage">添加管理员</a> </button>
      </dl>
    </div>
    <div class="am-btn-toolbars am-btn-toolbar am-kg am-cf">
      <ul>
        {{--<li style="margin-left: -10px;">--}}
          {{--<div class="am-btn-group am-btn-group-xs">--}}
            {{--<select data-am-selected="{btnWidth: 90, btnSize: 'sm', btnStyle: 'default'}">--}}
              {{--<option value="b">产品分类</option>--}}
              {{--<option value="o">下架</option>--}}
            {{--</select>--}}
          {{--</div>--}}
        {{--</li>--}}
        <li><input type="text" class="am-form-field am-input-sm am-input-xm" placeholder="关键词搜索" /></li>
        <li><button type="button" class="am-btn am-radius am-btn-xs am-btn-success" style="margin-top: -1px;">搜索</button></li>
      </ul>
    </div>
    <form class="am-form am-g" @click="systemInitialize()">

      <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped">
        <thead>
        <tr class="am-success">
          {{--<th class="table-check"><input type="checkbox" /></th>--}}
          <th >姓名</th>
          <th >电话</th>
          <th >邮箱</th>
          <th >职位</th>
          <th >是否分公司</th>
          <th >最近登录</th>
          <th >登录/禁止 <i class="am-icon-check am-text-warning"></i> <i class="am-icon-close am-text-primary"></i></th>
          <th >操作</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="user in users">
          {{--<td><input type="checkbox" /></td>--}}
          <td>@{{ user.name }}</td>
          <td>@{{ user.phone }}</td>
          <td>@{{ user.emil }}</td>
          <td>@{{ user.position }}</td>
          <td>
            <span v-if="user.is_branch == 0">总公司</span>
            <span v-if="user.is_branch != 0">...</span>
          </td>
          <td>@{{ user.login_time | time}}</td>
          <td class="am-hide-sm-only">
            <span v-if="user.status == 1"><i class="am-icon-check am-text-warning"></i></span>
            <span v-if="user.status == 2"><i class="am-icon-close am-text-primary"></i></span>
          </td>
          <td>
            <div class="am-btn-toolbar">
              <div class="am-btn-group am-btn-group-xs">
                {{--<button class="am-btn am-btn-default am-btn-xs am-text-success am-round"><span class="am-icon-search"></span> </button>--}}
                <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary am-round" v-on:click="edit(user.id)"><span class="am-icon-pencil-square-o"></span></button>
                {{--<button class="am-btn am-btn-default am-btn-xs am-text-warning  am-round"><span class="am-icon-copy"></span></button>--}}
                <button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger am-round" v-on:click="delet(user.id)"><span class="am-icon-trash-o"></span></button>
              </div>
            </div>
          </td>
        </tr>
        </tbody>
      </table>
      <ul class="am-pagination am-fr">
        <li class="am-disabled"><a href="#">«</a></li>
        <li class="am-active"><a href="#">1</a></li>
        <li><a href="#">2</a></li>
        <li><a href="#">3</a></li>
        <li><a href="#">4</a></li>
        <li><a href="#">5</a></li>
        <li><a href="#">»</a></li>
      </ul>
      <hr />
      <p>注：.....</p>
    </form>
      <script>
          var system = new Vue({
              el:"#system",
              data: {
                  users:[],// 系统管理员列表
              },
              //事件
              methods: {
                  //初始化 系统管理员列表
                  systemInitialize:function () {
                      $.post("/admin/system/user",{'_token':'{{csrf_token()}}',class:'select'},function (res) {
                          if(res.code){
                              system.users = res.data
                          } else {
                              layer.msg(res.data);
                          }
                      });
                  },
                  //编辑 分公司列表
                  edit:function (id) {
                      window.location.href="/admin/system/addUserPage?id="+id;
                  },
                  //删除 分公司列表
                  delet:function (id) {
                      $.post("/admin/system/user",{'_token':'{{csrf_token()}}',class:'delete',id:id},function (res) {
                          if(res.code){
                              layer.msg(res.data);
                              window.location.href="/admin/system/index";
                          } else {
                              layer.msg(res.data);
                          }
                      });
                  }
              },
              //自动执行
              mounted: function () {
                  this.systemInitialize();//分公司
              },
          })
      </script>
@include('Admin.public.foot')